MetaML and multi-stage programming with explicit annotations
نویسندگان
چکیده
We introduce MetaML, a practically-motivated, staticallytyped multi-stage programming language. MetaML is a \real" language. We have built an implementation and used it to solve multi-stage problems. MetaML allows the programmer to construct, combine, and execute code fragments in a type-safe manner. Code fragments can contain free variables, but they obey the static-scoping principle. MetaML performs typechecking for all stages once and for all before the execution of the rst stage. Certain anomalies with our rst MetaML implementation led us to formalize an illustrative subset of the MetaML implementation. We present both a big-step semantics and type system for this subset, and prove the type system's soundness with respect to a big-step semantics. From a software engineering point of view, this means that generators written in the MetaML subset never generate unsafe programs. A type system and semantics for full MetaML is still ongoing work. We argue that multi-stage languages are useful as programming languages in their own right, that they supply a sound basis for high-level program generation technology, and that they should support features that make it possible for programmers to write staged computations without signi cantly changing their normal programming style. To illustrate this we provide a simple three stage example elaborating a number of practical issues. The design of MetaML was based on two main principles that we identi ed as fundamental for high-level program generation, namely, crossstage persistence and cross-stage safety. We present these principles, explain the technical problems they give rise to, and how we address with these problems in our implementation.
منابع مشابه
Integrating Normalization-by-Evaluation into a Staged Programming Language
We have designed MetaML a multi-stage programming language, as a meta-programming system, i.e. a system which is used to write programs (meta-programs) whose sole purpose is to build and manipulate other programs (objectprograms). MetaML programs are simply ML programs which are annotated with staging operators. There is a strong connection between o -line partial evaluation and staged programm...
متن کاملMetaML: Multi-Stage Programming with Explicit Annotations
We introduce MetaML, a practically-motivated, statically-typed multi-stage programming language. MetaML allows the programmer to construct, combine, and execute code fragments in a type-safe manner. Code fragments can contain free variables, but we ensure that the language obeys the static-scoping principle. MetaML performs type-checking for all stages once and for all before the execution of t...
متن کاملA Monadic Multi-stage Metalanguage
We describe a metalanguage MMML, which makes explicit the order of evaluation (in the spirit of monadic metalanguages) and the staging of computations (as in languages for multi-level binding-time analysis). The operational semantics of MMML is very intuitive and consists of two parts: local (semantic preserving) simplification rules, and steps of computation executed in a deterministic order (...
متن کاملA Sound Reduction Semantics for Untyped CBN Multi - Stage Computation . Or , the Theory of MetaML is Non - trivial
A multi-stage computation is one involving more than one stage of execution. MetaML is a language for programming multi-stage computations. Previous studies presented big-step semantics, categorical semantics, and sound type systems for MetaML. In this paper, we report on a conuent and sound reduction semantics for untyped call-by name (CBN) MetaML. The reduction semantics can be used to formal...
متن کاملHigher-Order Types and Meta-Programming for Global Computing
MetaKlaim is a case study in modeling the spatial, temporal and security aspects necessary for global computing. MetaKlaim integrates MetaML (an extension of SML for multi-stage programming) and Klaim (a Kernel Language for Agents Interaction and Mobility), in order to allow interleaving of meta-programming activities (like assembly and linking of code fragments), security checks (like typechec...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- Theor. Comput. Sci.
دوره 248 شماره
صفحات -
تاریخ انتشار 2000